package com.jsr303;

import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import java.util.Set;

/**
 * Created by pengfei on 16/7/18.
 */
public class Test {
    public static void main(String[] args) {
        Person p = new Person();
        p.setName("a");
//        p.setEmail("xx");
        p.setPrice(0);
        ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
        Validator validator = factory.getValidator();
        Set<ConstraintViolation<Person>> violations = validator.validate(p);
        System.out.println(violations);

    }
}
